<template>
  <view class="section-layout">
    <view class="section-header">
      <view class="section-title">
        <view class="title">
          <slot name="title"></slot>
        </view>
        <view v-if="$slots['title-extra']" class="title-extra">
          <slot name="title-extra"></slot>
        </view>
      </view>
      <view v-if="$slots.header" class="header-extra">
        <slot name="header"></slot>
      </view>
    </view>

    <view class="section-body">
      <slot></slot>
    </view>

    <block v-if="$slots.footer">
      <view class="section-footer">
        <slot name="footer"></slot>
      </view>
    </block>
  </view>
</template>

<style scoped lang="less">
.section-layout {
  display: flex;
  flex-flow: column nowrap;
  overflow: hidden;
  height: 100%;
}
.section-header {
  flex-shrink: 0;
  padding: 24rpx 32rpx 0;
  background-color: #ffffff;
  .header-extra {
    margin-top: 6rpx;
  }
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  .title {
    font-weight: 600;
    font-size: 48rpx;
    line-height: 68rpx;
    color: var(--dark-color);
  }
  .title-extra {
    font-weight: 600;
    font-size: 28rpx;
    line-height: 40rpx;
  }
}
.section-body {
  flex: 1;
  overflow: auto;
}
</style>
